package com.mxchip.livestar.ui.network.wifi.widget;

import android.content.Context;
import android.widget.TextView;

import com.mxchip.livestar.R;
import com.mxchip.livestar.ui.network.wifi.widget.base.Dialog;


public class NoPassDialog extends Dialog {
    String content;

    public NoPassDialog(Context context) {
        super(context);
    }

    @Override
    protected int getLayout() {
        return R.layout.dialog_no_pass;
    }


    public void onCancelClick() {
        dismiss();
    }

    public interface OnConnectDialogListener {
        void onConfirm();
    }

    public NoPassDialog content(String content) {
        this.content = content;
        return this;
    }

    @Override
    protected void initView() {
        ((TextView) inflate.findViewById(R.id.tv_content)).setText(content);
        ((TextView) inflate.findViewById(R.id.tv_cancel)).setOnClickListener(v->onCancelClick());
        ((TextView) inflate.findViewById(R.id.tv_confirm)).setOnClickListener(v->onConfirmClick());
    }

    OnConnectDialogListener onConnectDialogListener;

    public NoPassDialog setOnConnectDialogListener(OnConnectDialogListener onConnectDialogListener) {
        this.onConnectDialogListener = onConnectDialogListener;
        return this;
    }

    public void onConfirmClick() {
        dismiss();
        if (onConnectDialogListener != null)
            onConnectDialogListener.onConfirm();
    }
}
